/// 🔄 分享请求模型
/// 
/// 用于创建分享链接的请求数据
class ShareRequest {
  final String shareTitle;        // 分享标题
  final String userId;             // 用户ID
  final String userNickname;       // 用户昵称
  final String userGender;         // 用户性别
  final String userCity;           // 用户城市
  final String userAvatarUrl;      // 用户头像URL
  final String contentType;        // 内容类型：'activity'（活动）、'comment'（评论）
  final String contentTitle;       // 内容标题
  final String contentText;        // 内容描述
  final List<String> contentImages; // 内容图片列表
  final int timestamp;             // 时间戳

  ShareRequest({
    required this.shareTitle,
    required this.userId,
    required this.userNickname,
    required this.userGender,
    required this.userCity,
    required this.userAvatarUrl,
    required this.contentType,
    required this.contentTitle,
    required this.contentText,
    required this.contentImages,
    required this.timestamp,
  });

  /// 转换为JSON
  Map<String, dynamic> toJson() {
    return {
      'shareTitle': shareTitle,
      'userId': userId,
      'userNickname': userNickname,
      'userGender': userGender,
      'userCity': userCity,
      'userAvatarUrl': userAvatarUrl,
      'contentType': contentType,
      'contentTitle': contentTitle,
      'contentText': contentText,
      'contentImages': contentImages,
      'timestamp': timestamp,
    };
  }

  /// 从JSON创建
  factory ShareRequest.fromJson(Map<String, dynamic> json) {
    return ShareRequest(
      shareTitle: json['shareTitle'] ?? '',
      userId: json['userId'] ?? '',
      userNickname: json['userNickname'] ?? '',
      userGender: json['userGender'] ?? '',
      userCity: json['userCity'] ?? '',
      userAvatarUrl: json['userAvatarUrl'] ?? '',
      contentType: json['contentType'] ?? '',
      contentTitle: json['contentTitle'] ?? '',
      contentText: json['contentText'] ?? '',
      contentImages: List<String>.from(json['contentImages'] ?? []),
      timestamp: json['timestamp'] ?? 0,
    );
  }
}

